package com.google.android.vending.expansion.downloader.impl;

import android.text.format.Time;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public final class HttpDateTime
{
  private static final Pattern HTTP_DATE_ANSIC_PATTERN = Pattern.compile("[ ]([A-Za-z]{3,9})[ ]+([0-9]{1,2})[ ]([0-9]{1,2}:[0-9][0-9]:[0-9][0-9])[ ]([0-9]{2,4})");
  private static final String HTTP_DATE_ANSIC_REGEXP = "[ ]([A-Za-z]{3,9})[ ]+([0-9]{1,2})[ ]([0-9]{1,2}:[0-9][0-9]:[0-9][0-9])[ ]([0-9]{2,4})";
  private static final Pattern HTTP_DATE_RFC_PATTERN = Pattern.compile("([0-9]{1,2})[- ]([A-Za-z]{3,9})[- ]([0-9]{2,4})[ ]([0-9]{1,2}:[0-9][0-9]:[0-9][0-9])");
  private static final String HTTP_DATE_RFC_REGEXP = "([0-9]{1,2})[- ]([A-Za-z]{3,9})[- ]([0-9]{2,4})[ ]([0-9]{1,2}:[0-9][0-9]:[0-9][0-9])";

  private static int getDate(String paramString)
  {
    if (paramString.length() == 2)
      return 10 * ('￐' + paramString.charAt(0)) + ('￐' + paramString.charAt(1));
    return '￐' + paramString.charAt(0);
  }

  private static int getMonth(String paramString)
  {
    int i = -291 + (Character.toLowerCase(paramString.charAt(0)) + Character.toLowerCase(paramString.charAt(1)) + Character.toLowerCase(paramString.charAt(2)));
    int j = 0;
    switch (i)
    {
    default:
      throw new IllegalArgumentException();
    case 10:
      j = 1;
    case 22:
      return j;
    case 29:
      return 2;
    case 32:
      return 3;
    case 36:
      return 4;
    case 42:
      return 5;
    case 40:
      return 6;
    case 26:
      return 7;
    case 37:
      return 8;
    case 35:
      return 9;
    case 48:
      return 10;
    case 9:
    }
    return 11;
  }

  private static TimeOfDay getTime(String paramString)
  {
    int i = 0 + 1;
    int j = '￐' + paramString.charAt(0);
    int k;
    if (paramString.charAt(i) != ':')
    {
      int i7 = j * 10;
      k = i + 1;
      j = i7 + ('￐' + paramString.charAt(i));
    }
    while (true)
    {
      int m = k + 1;
      int n = m + 1;
      int i1 = 10 * ('￐' + paramString.charAt(m));
      int i2 = n + 1;
      int i3 = i1 + ('￐' + paramString.charAt(n));
      int i4 = i2 + 1;
      int i5 = i4 + 1;
      int i6 = 10 * ('￐' + paramString.charAt(i4));
      (i5 + 1);
      return new TimeOfDay(j, i3, i6 + ('￐' + paramString.charAt(i5)));
      k = i;
    }
  }

  private static int getYear(String paramString)
  {
    if (paramString.length() == 2)
    {
      int i = 10 * ('￐' + paramString.charAt(0)) + ('￐' + paramString.charAt(1));
      if (i >= 70)
        return i + 1900;
      return i + 2000;
    }
    if (paramString.length() == 3)
      return 1900 + (100 * ('￐' + paramString.charAt(0)) + 10 * ('￐' + paramString.charAt(1)) + ('￐' + paramString.charAt(2)));
    if (paramString.length() == 4)
      return 1000 * ('￐' + paramString.charAt(0)) + 100 * ('￐' + paramString.charAt(1)) + 10 * ('￐' + paramString.charAt(2)) + ('￐' + paramString.charAt(3));
    return 1970;
  }

  public static long parse(String paramString)
    throws IllegalArgumentException
  {
    Matcher localMatcher1 = HTTP_DATE_RFC_PATTERN.matcher(paramString);
    int j;
    int i;
    int k;
    TimeOfDay localTimeOfDay;
    if (localMatcher1.find())
    {
      j = getDate(localMatcher1.group(1));
      i = getMonth(localMatcher1.group(2));
      k = getYear(localMatcher1.group(3));
      localTimeOfDay = getTime(localMatcher1.group(4));
    }
    while (true)
    {
      if (k >= 2038)
      {
        k = 2038;
        i = 0;
        j = 1;
      }
      Time localTime = new Time("UTC");
      localTime.set(localTimeOfDay.second, localTimeOfDay.minute, localTimeOfDay.hour, j, i, k);
      return localTime.toMillis(false);
      Matcher localMatcher2 = HTTP_DATE_ANSIC_PATTERN.matcher(paramString);
      if (!localMatcher2.find())
        break;
      i = getMonth(localMatcher2.group(1));
      j = getDate(localMatcher2.group(2));
      localTimeOfDay = getTime(localMatcher2.group(3));
      k = getYear(localMatcher2.group(4));
    }
    throw new IllegalArgumentException();
  }

  private static class TimeOfDay
  {
    int hour;
    int minute;
    int second;

    TimeOfDay(int paramInt1, int paramInt2, int paramInt3)
    {
      this.hour = paramInt1;
      this.minute = paramInt2;
      this.second = paramInt3;
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.google.android.vending.expansion.downloader.impl.HttpDateTime
 * JD-Core Version:    0.6.2
 */